from typing import List


class Solution:
    def jump(self, nums: List[int]) -> int:
        f = [0] * len(nums)  # f[i]表示跳到点i的最小步数
        j = 0
        for i in range(1, len(nums)):  # f[0] = 0
            while j + nums[j] < i:
                j += 1
            f[i] = f[j] + 1
        return f[len(nums) - 1]

a = [2,3,1,1,4]
t = Solution().jump(a)
print(t)
